package com.car.order.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.car.commons.core.model.Result;
import com.car.order.entity.StoresInfo;
import com.car.order.entity.form.storesInfo.StoresInfoFindPageForm;
import com.car.order.entity.form.storesInfo.StoresInfoInsertForm;
import com.car.order.service.StoresInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;

/**
 *
 *
 * @author 杜岷芫
 * @since 2024-09-03 15:16:50
 */
@RestController
@RequestMapping("/storesInfo")
@Api(tags = "门店信息")
public class StoresInfoController {

    @Autowired
    private StoresInfoService storesInfoService;

    /**
     * 分页查询
     *
     * @param form
     * @return
     */
    @ApiOperation(value = "新增")
    @PostMapping("/insert")
    public Result insert(@RequestBody StoresInfoInsertForm form) throws Exception{
        StoresInfo result = storesInfoService.insert(form);
        return Result.getResult().setMsg("查询成功").setData(result);
    }

    @ApiOperation(value = "分页查询")
    @PostMapping("/findPage")
    public Result findPage(@RequestBody StoresInfoFindPageForm form) throws Exception{
        Page<StoresInfo> result = storesInfoService.findPage(form);
        return Result.getResult().setMsg("查询成功").setData(result);
    }
}